package interfaces;

import java.io.IOException;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.Vector;

import valueObjects.game.Player;
import exception.player.NotEqualPasswordException;
import exception.player.PlayerAlreadyExistsException;
import exception.player.PlayerNotSavedException;

public interface IPlayerManagement extends Remote {

	
	/**
	 * Checks whether the given player is the current player
	 * @param p
	 * @return
	 */
	public boolean isCurrentPlayer(Player p) throws RemoteException;
	
	/**
	 * @return the currentPlayers
	 */
	public Vector<Player> getCurrentPlayers() throws RemoteException;

	/**
	 * Returns a list of the registered players
	 * @return
	 */
	public Vector<Player> getListOfPlayers() throws RemoteException;

	/**
	 * Adds a player to the list of players
	 * @param player
	 */
	public void addNewPlayer(Player player) throws RemoteException;

	/**
	 * Loads a list of saved players from a file
	 * @param file
	 * @throws IOException
	 * @throws ClassNotFoundException
	 */
	public void loadListOfPlayers() throws IOException,
			ClassNotFoundException, RemoteException;

	/**
	 * Saves a player to a file
	 * @param 
	 * @return 
	 * @throws ClassNotFoundException 
	 * @throws PlayerNotSavedException
	 * @throws IOException 
	 * @throws PlayerAlreadyExistsException 
	 * @throws NotEqualPasswordException 
	 */
	public void saveNewPlayer(String username, String passwordF,
			String passwordS) throws PlayerAlreadyExistsException,
			NotEqualPasswordException, PlayerNotSavedException, RemoteException;

	/**
	 * Adds a logged in player to the currentplayer's list
	 * @param player
	 */
	public void addCurrentPlayer(Player player) throws RemoteException;

	/**
	 * Returns the current player of the game
	 * @return
	 * @throws RemoteException
	 */
	public Player getCurrentPlayer() throws RemoteException;
	
	/**
	 * When a player is finished with his turn. Sets next players as current player.
	 * @param p
	 * @param card 
	 * @throws IOException 
	 */
	public void finish(Player p) throws RemoteException, IOException;

	/**
	 * Sets the current player for the game
	 * @param p
	 * @throws RemoteException
	 */
	public void setCurrentPlayer(Player p) throws RemoteException;

	/**
	 * Resets the lists for interaction cards
	 * @throws RemoteException
	 */
	public void removeInteraction() throws RemoteException;


}